#! /bin/bash

   NODE_NPM_PATH=.
 NODE_SERVER_DIR=/pub/webnode
NODE_SERVER_USER=root

node_init(){
    msg info "Initialize node config, set prefix to $NODE_NPM_PATH"
    npm config set prefix $NODE_NPM_PATH
    npm install
}

node_build(){
    case $1 in 
        webpack)
            # build
            webpack_js=./node_modules/webpack/bin/webpack.js

            test -f $webpack_js || msg error "File not found: $webpack_js"
            $webpack_js
    
            test $? != 0 && msg error "build failed"
            ;;
    esac
}
